﻿using IService.Login;
using Model.Login;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace Service.Login
{
    public class LoginService : ILoginService
    {
        public Tuple<UserInfo, string> GetLogin(string username,string password)
        {
            if (string.IsNullOrWhiteSpace(username))
                throw new ArgumentNullException(nameof(username));
            if (string.IsNullOrWhiteSpace(password))
                throw new ArgumentNullException(nameof(password));
            if (!username.Equals("BlueRocks"))
                return new Tuple<UserInfo, string>(null, "用户名不存在!");
            if (!password.Equals("wfkbitol"))
                return new Tuple<UserInfo, string>(null, "密码错误!");
            UserInfo userInfo = new UserInfo
            {
                UserId = "0001",
                UserName = "BlueRocks"
            };
            return new Tuple<UserInfo, string>(userInfo, null);  
        }
    }
}
